#! /bin/sh

WIDTH=420
HEIGHT=300
XOFF1=0
XOFF2=425
YOFF1=2
YOFF2=450

MARM=$CWPROOT/src/demos/Velocity_Profiles/Marmousi
S=.

zcat $MARM/marmhard.dat.gz | a2b n1=1 |
unisam2 nx2=384 dx2=2.6667 fx2=0 n2=1024 d2=1 f2=0 nx1=122 \
dx1=4.1967 fx1=0 n1=512 d1=1 f1=0 method=linear | suaddhead ns=512 > model.su


p1=9 p2=10
#nc1=256 nc2=512
n1=512 n2=1024
nt1=256 nt2=512

model=$S/model.su
#trimfile=$S/trimfile.2p
infile=$S/model.2p
mrafile=$S/mramodel.2p
dfile=$S/dmodel.2p
dmrafile=$S/dmramodel.2p
reconfile=$S/reconmodel.2p
reconmrafile=$S/reconmramodel.2p
mraMarmousips=$S/mraMarmousi.ps
difMarmousips=$S/difMarmousi.ps
Marmousips=$S/Marmousi.ps
reconMarmousips=$S/reconMarmousi.ps
trunc=0.003

sustrip < $model |
mrafxzwt > $mrafile \
n1=$n1 n2=$n2 \
trimfile=$trimfile \
verbose=1 nd=4 p1=$p1 p2=$p2 \
mralevel2=3 mralevel1=3 \
title="Model" \
dfile=$dfile \
dmrafile=$dmrafile \
reconfile=$reconfile \
reconmrafile=$reconmrafile \
trunc=$trunc

suximage < $model  \
title="Original Marmousi Model" \
wbox=${WIDTH} hbox=${HEIGHT} xbox=${XOFF1} ybox=${YOFF1} &

ximage n1=$n1 n2=$n2 < $mrafile  \
title="MRA of the Model with DC overexposured" \
perc=98 \
wbox=${WIDTH} hbox=${HEIGHT} xbox=${XOFF1} ybox=${YOFF2} &

ximage n1=$n1 n2=$n2 < $reconfile   \
wbox=${WIDTH} hbox=${HEIGHT} xbox=${XOFF2} ybox=${YOFF1} \
title="Reconstructed Model 17:1" &

ximage n1=$n1 n2=$n2 < $dfile  \
wbox=${WIDTH} hbox=${HEIGHT} xbox=${XOFF2} ybox=${YOFF2} \
title="Model Difference" &

exit 0
